<?php

namespace App\Models;
/**
 * Class Module
 * @package App\Models
 */
class Module extends BaseModel
{

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function permissions()
    {
        return $this->hasMany(Permission::class, 'module_id');
    }
    //
    public static function boot()
    {
        parent::boot();
        static::deleted(function (Module $code) {
            $code->permissions()->delete();
        });
    }
}
